import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { TutorialService } from 'src/app/service/tutorialService';
import { Location } from '@angular/common';

@Component({
  selector: 'app-tutorial-template',
  templateUrl: './tutorial-template.component.html',
  styleUrls: ['./tutorial-template.component.css']
})
export class TutorialTemplateComponent implements OnInit {

  tutorialId: number;
  tutorialName: string;

  constructor(private route: ActivatedRoute,
              private tutorialService: TutorialService,
              private location: Location) { }

  ngOnInit(): void {
    this.tutorialId =  this.route.snapshot.queryParams["id"];
    this.tutorialService.getMarkdownFile(this.tutorialId).subscribe(data=>{
      this.tutorialName = data.filename
      console.log(data);
    })
  }

  back(){
    this.location.back();
  }

}
